﻿<Window x:Class="GA_SCHED_DESIGNER.SchedWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="SchedWindow" Height="300" Width="460" 
        xmlns:db="clr-namespace:Acceron.University.DBAccess;assembly=Acceron.University.DBAccess">
        
    <Window.Resources>
        <db:CRM_University_GADataContext x:Key="dbConetxtKey" />
    </Window.Resources>
    
    <Grid>
        <DataGrid AutoGenerateColumns="False" Margin="0,12,0,29" Name="dataGrid1" ItemsSource="{Binding Source={StaticResource dbConetxtKey}, Path=Classes}">
            <DataGrid.Columns>
                <DataGridComboBoxColumn x:Name="CourseCol" Header="Предмет"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Course_ID"
                                        ItemsSource="{Binding Source={StaticResource dbConetxtKey}, Path=Courses}" 
                                        SelectedValueBinding="{Binding Course_ID}"/>
                
                <DataGridTemplateColumn Header="Header">
                    <DataGridTemplateColumn.CellEditingTemplate>
                        <DataTemplate>
                            <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding GroupClasses}">
                                <DataGrid.Columns>
                                    <DataGridComboBoxColumn 
                                        Width="*"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Group_ID"
                                        SelectedValueBinding="{Binding Groupd_ID}"
                                        ItemsSource="{Binding Source={StaticResource dbConetxtKey}, Path=Groups}">
                                    </DataGridComboBoxColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellEditingTemplate>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <Label  Content="Кликните, чтобы изменить" Foreground="#A3000000" ForceCursor="False" FontStyle="Italic"></Label>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridComboBoxColumn x:Name="ProfCol" Header="Преподаватель" 
                                        SelectedValueBinding="{Binding Prof_ID}"
                                        ItemsSource="{Binding Source={StaticResource dbConetxtKey}, Path=Professors}"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Prof_ID"
                                        />
                
                <DataGridTextColumn Width="*" Header="Продолжительность" Binding="{Binding Duration}" />
                <DataGridCheckBoxColumn Header="Л/Р" Binding="{Binding IsLab}" />
            </DataGrid.Columns>
            <!--
            <DataGrid.RowDetailsTemplate>
                <DataTemplate>
                    <DataGrid ItemsSource="{Binding GroupClasses}" AutoGenerateColumns="False" HeadersVisibility="Column">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Группа" Binding="{Binding Path=Group.Name}">
                                
                            </DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </DataTemplate>
            </DataGrid.RowDetailsTemplate>
            -->
        </DataGrid>
        <Button Click="button1_Click" Content="Сохранить" Height="23" HorizontalAlignment="Right" Margin="0,0,81,0" Name="button1" VerticalAlignment="Bottom" Width="75" />
        <Button Click="button2_Click" Content="Отмена" Height="23" HorizontalAlignment="Right" Name="button2" VerticalAlignment="Bottom" Width="75" />
    </Grid>
</Window>
